import logging
import time
import os

#set main logger
logger_name = 'Master'
logger = logging.getLogger(logger_name)
logger.setLevel(logging.DEBUG)

#set fmt
fmt = "%(asctime)s - %(filename)s - %(funcName)s - %(name)s - %(levelname)s - %(message)s"
formatter = logging.Formatter(fmt)

#set stream handler
sh = logging.StreamHandler()
sh.setLevel(logging.INFO)
sh.setFormatter(formatter)

logger.addHandler(sh)

#set file handler
path = os.getcwd() + '//' + 'log'
file = "DeleteFileTool_{0}_log.txt".format(time.strftime("%Y%m%d%H%M%S", time.localtime()))
filename = path + '//'+ file

fh = logging.FileHandler(filename)
fh.setLevel(logging.DEBUG)
fh.setFormatter(formatter)

logger.addHandler(fh)

#test beginning
logger.info('Logging function enable.')
logger.info('Logging stream level {}.'.format('Info'))
logger.info('Logging file level {}.\n'.format('Debug'))
#logger.debug('Loggin debug level testing.')
#logger.warning('Logging warning level testing.')
#logger.error('Logging error level testing.')



